VtSelectionDialog


Create a Selection dialog

Syntax

VtSelectionDialog object_name [options]

Description

Creates a Selection dialog which allows the user to select an item from a list or type the item in a text field. The text field is automatically updated to the item selected from the list. All the Dialog options are available to this widget. Returns the dialog widget's name.

By default, Selection dialogs have an OK, Cancel, and Help button. To override the default buttons, the options -ok, -cancel, and -help can be used to specify which buttons go in the dialog. If any one of these options is used then it is assumed that only buttons which have been individually specified or referenced via either a label or a callback option will be put in the dialog.

If the user chooses either the OK or Cancel button, the dialog is automatically popped down and destroyed, and the user's selection passed as a parameter to the OK callback. To override this default use the -autoHide and -autoDestroy options.

Options

-filename string (CS)
Specifies that the file (named string) contains the list of items. Each line of the file is considered a list item. The full pathname of the file must be specified.

-itemList list (CS)
Specifies the list of items for the SelectionBox.

-selection string (CS)
Specifies the default contents of the selection in the SelectionBox text widget

Example

The following code produces a SelectionBox dialog containing a number of options, a default selection, an OK button and a Help button.

set app [VtOpen "VtSelectionDialog Demo"]

set selection [VtSelectionDialog $app.selection \
        -itemList {apple banana kumquat grape mango} \
        -selection kumquat \
        -ok \
        -help]

VtShow $selection

VtMainLoop

This code produces the following:

See also: